package com.yxw.live_vod_boot.controller;

import com.yxw.live_vod_boot.dto.YxVideoCoinExchangeDTO;
import com.yxw.live_vod_boot.service.VideoCoinExchangeService;
import com.yxw.live_vod_boot.vo.YxVideoCoinExchangeVO;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 视频币兑换
 * @author xiexuxin
 * @date 2023-11-16
 */
@RestController
@Api(value = "视频币兑换", tags = "视频币兑换")
@Slf4j
@Validated
@RequestMapping("/api/videoCoinExchange")
public class VideoCoinExchangeController {

    @Autowired
    private VideoCoinExchangeService videoCoinExchangeService;

    @ApiOperation(value = "兑换视频币")
    @PostMapping(value = "/video_coin_exchange")
    public BaseResult videoCoinExchange(@RequestBody YxVideoCoinExchangeDTO videoCoinExchangeDTO) {
        YxVideoCoinExchangeVO vo = videoCoinExchangeService.videoCurrencyExchange(videoCoinExchangeDTO);
        return BaseResult.doSuccess(vo,"兑换成功");
    }

    @ApiOperation(value = "根据店铺id查询视频币兑换数据")
    @PostMapping(value = "/get_by_exchange_shop_id")
    public BaseResult getByExchangeShopId(@RequestParam("exchangeShopId") Long exchangeShopId) {
        YxVideoCoinExchangeVO vo = videoCoinExchangeService.getByExchangeShopId(exchangeShopId);
        return BaseResult.doSuccess(vo,"查询成功");
    }
}
